﻿using MX.Core.Http.WebAction;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace MX.Core.HTTP.WebAction
{
    public class BytePostInfo : PostInfo
    {
        byte[] data;
        public BytePostInfo(string str ,string formEncoding= "utf-8") : base(
            PostContentType.Application_XWwwFormUrlencoded(), formEncoding)
        {
            data = Encoding.GetEncoding(formEncoding).GetBytes(str);
        }

        public override byte[] GetPostData()
        {
            return data;
        }

        public override string GetPostString()
        {
            return Encoding.GetEncoding(FormEncoding).GetString(data);
        }
    }
}
